
from sys import argv
from os import listdir

oldpath = "../images/"
newpath = "../../resources/TestScene/images/"

basepath = "."
if len(argv) > 1:
    basepath = argv[1]
    
for entry in listdir(basepath):
    if entry[entry.rfind('.')+1:] == "irrmesh":
        oldfile = open(entry, "r")
        newdata = oldfile.read().replace(oldpath, newpath)
        file.close(oldfile)
        open(entry, "w").write(newdata)
        print entry, "processed"
